
#include "stdafx.h"

TEST(closesocketTest, closesocket_in_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "closesocket");
    closesocket_in_inout closesocketIN(sock);
    closesocket_in_inout closesocketOUT;

    std::vector<char> buffer;
    Serialize(header, closesocketIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(closesocketOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (closesocketIN.s_, closesocketOUT.s_);
}

//TEST(closesocketTest, closesocket_in_inout_NULL_parameters)
//{
//    
//}

TEST(closesocketTest, closesocket_out_inout)
{
    SOCKET sock = INVALID_SOCKET;
    
    Header header(GetCurrentThreadId(), "closesocket");
    closesocket_out_inout closesocketIN(7);
    closesocket_out_inout closesocketOUT;

    std::vector<char> buffer;
    Serialize(header, closesocketIN, buffer);
        
    Deserialize deserialize(buffer);
    deserialize(closesocketOUT);

    EXPECT_EQ (header.TID_, deserialize.get_header().TID_);
    EXPECT_EQ (header.func_name_, deserialize.get_header().func_name_);

    EXPECT_EQ (closesocketIN.wsa_last_error_, closesocketOUT.wsa_last_error_);
}

//TEST(closesocketTest, closesocket_out_inout_NULL_parameters)
//{
//    
//}